<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Document</title>
	<script type="text/javascript">
		new S.AutoComplete({
			el:'#model_manager_txt',
			url:'${webcontext}/${pathvar.admin}/user/search',
			render:function(data){
				return '<b>'+data.realName+'</b> <span>'+data.orgName+'</span>';
			},
			click:function(data){
				$('#model_manager_txt').val(data.realName+'('+data.orgName+')');
				$('#model_manager_txt').attr('readonly','readonly');
				$('#model_manager_txt').parent().parent().append('<i class="sclose">x</i>');
				$('#model_manager').val(data.id);
			}
		});
		
		$('#model_manager').parent().delegate('.sclose','click',function(){
			$('#model_manager').val('');
			$(this).remove();
			$('#model_manager_txt').removeAttr('readonly').val('');
		});	
	
	</script>
</head>
<body>
	<div class="content">
	<form>
		<table width="100%">
			<tr>
				<td width="60">父级</td>
				<td><input type="text" class="long" value="${pmodel.name }" disabled="disabled"></td>
			</tr>
			<tr>
				<td width="60">名称</td>
				<td><input type="text" name="name" class="long" value="${model.name }" check="required"></td>
			</tr>
			<tr>
				<td>负责人</td>
				<td>
					<input type="hidden" name="projectId" value="${model.projectId }">
					<input type="hidden" name="pid" value="${pmodel.id }">
					<input type="hidden" name="id" value="${model.id }">
					<input type="hidden" id="model_manager" name="manager" value="${model.manager }"/>
					<c:choose>
						<c:when test="${owner!=null }"><span><input type="text" id="model_manager_txt" value="${owner.realName }" readonly="readonly"/></span><i class="sclose">x</i></c:when>
						<c:otherwise><input type="text" id="model_manager_txt" /></c:otherwise>
					</c:choose>
 				</td>
			</tr>
		</table>
	</form>
	</div>
</body>
</html>